package com.xuecheng.content.convert;

import com.xuecheng.api.content.model.dto.CourseBaseDTO;
import com.xuecheng.api.content.model.vo.CourseAuditVO;
import com.xuecheng.api.content.model.vo.CourseBaseVO;
import com.xuecheng.content.entity.CourseBase;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface EntityMapper {

    EntityMapper INSTANCE = Mappers.getMapper(EntityMapper.class);

    @Mappings({
            @Mapping( source = "id",target = "courseBaseId")
    })
    CourseBaseDTO courseBaseToCourseBaseDTo(CourseBase courseBase);




    @Mappings({
            @Mapping( source = "courseBaseId",target = "courseBaseId")
    })
    CourseBaseDTO courseAuditVoToCourseBaseDTo(CourseAuditVO vo);
    CourseBaseDTO courseBaseVoToCourseBaseDTo(CourseBaseVO vo);


    /*
     * PS: 集合数据的转换必须要在单个数据转换方法的基础上才能完成
     *       entitys2dtos 依赖  entity2dto
     *
     * */
    List<CourseBaseDTO> courseBaseToCourseBaseDToList(List<CourseBase> courseBaseList);
}
